{{template "admin/header"}}
<div class="mdui-typo crumbs row">
  <h1>文章列表</h1>
  <div>
    <span>/</span>
    <a href="/admin/" class="">
      <i class="mdui-icon material-icons">home</i>首页</a
    >
    <span> /</span>
    <i>文章列表</i>
  </div>
</div>

<!-- Action -->
<div
  class="row"
  style="justify-content: flex-end; margin: 0 0 20px 0; align-items: center;"
>
  <div style="flex: 1;">
    <a href="post/add" class="mdui-btn mdui-color-theme-accent mdui-ripple"
      >发布文章</a
    >
    <a href="" class="mdui-btn mdui-ripple">隐藏文章</a>
    <a href="" class="mdui-btn mdui-ripple">批量删除</a>
  </div>
  <div>
    {{template "pageview" .}}
  </div>
</div>
<!-- table  -->
<div class="mdui-table-fluid mdui-shadow-0">
  <table class="mdui-table mdui-table-selectable">
    <thead>
      <tr>
        <th>标题</th>
        <th>简介</th>
        <th>
          邮箱
        </th>

        <th>tag</th>
        <th>作者</th>

        <th>发布时间</th>
        <th>
          更新时间
        </th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      {{range .posts.List}}
      <tr>
        <td style="max-width: 200px;">{{strDefault .Title "未设置标题"}}</td>
        <td style="max-width: 300px;">
          {{$desc := strDefault .Desc "暂无简介..."}} {{trunc 60 $desc}}
        </td>
        <td>{{.Email}}</td>
        <td>{{.Tag}}</td>
        <td>{{.Author}}</td>
        <td>{{timeFormat .CreatedAt}}</td>
        <td>{{timeFormat .UpdatedAt}}</td>
        <td style="width: 10em;">
          <a href="" class="mdui-text-color-indigo">编辑</a>
          <span>/</span>
          <a href="" class="mdui-text-color-red">删除</a>
        </td>
      </tr>
      {{end}}
    </tbody>
  </table>
</div>
<div>
  {{template "pageview" .}}
</div>
{{template "admin/footer"}}
